// 题目链接：https://www.luogu.com.cn/problem/P1443

#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <queue>

#define x first
#define y second

using namespace std;

typedef pair<int, int> PII;

const int N = 405;
const int M = 405;

int dist[N][M];
int n, m;
int x0, y0;
queue<PII> q;

int dx[] = {-1, -2, -2, -1, 1, 2, 2, 1};
int dy[] = {2, 1, -1, -2, -2, -1, 1, 2};

void BFS(int x0, int y0)
{
    memset(dist, -1, sizeof dist);
    q.push({x0, y0});
    dist[x0][y0] = 0;

    while (!q.empty())
    {
        auto t = q.front();
        q.pop();

        for (int i = 0; i < 8; ++i)
        {
            int next_x = t.x + dx[i];
            int next_y = t.y + dy[i];

            if (next_x <= 0 || next_x > n || next_y <= 0 || next_y > m)
                continue;
            if (dist[next_x][next_y] >= 0)
                continue;

            q.push({next_x, next_y});
            dist[next_x][next_y] = dist[t.x][t.y] + 1;
        }
    }
}

int main()
{
    cin >> n >> m >> x0 >> y0;

    BFS(x0, y0);

    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= m; ++j)
        {
            cout << left << setw(5) << dist[i][j];
        }
        cout << endl;
    }

    return 0;
}